package pers.course.week3;

import java.util.Scanner;

public class Reverse_Che {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int count = 0, a = 0;
        int[] Shu = new int[100];
        for (int i = 0; i < n; i++) {
            int shu = s.nextInt();
            if (shu < 0) {
                shu = -shu;
                a = 1;
            }
            for (int j = 0; shu != 0; j++) {
                Shu[j] = shu % 10;
                shu = shu / 10;
                count++;
            }
            for (int j = 0; j < count; j++) {
                shu = shu * 10 + Shu[j];
            }
            if (a == 0) System.out.println(shu);
            if (a == 1) System.out.println(-shu);
            count = 0;
        }
    }
}